package primary.others;

/**
 * @Author Elephas
 * @Date 2022/1/11
 **/
public class HammingDistance {
    public int hammingDistance(int x,int y){
        int distance = 0;
        for (int i = 0; i < 32; i++) {
            distance += (x&0x1) ^ (y&0x1);
            x = x>>1;
            y = y>>1;
        }
        return distance;
    }

}
